/**
 * DLR端的接口
 * 
 * @Author: baiyuxin
 * @Date: 2019-9-10
 * @Last Modified by:   baiyuxin
 * @Last Modified time: 2019-9-10 14:26:34
 */
import axios from '@/api/fetch';
import * as types from '../types';
import SERVER from '@/api/server';

let modelUrl = 'dlr/';

//查询全部列表（自定义数据过滤）@0
export const findAllPage = params => {
    return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject`,{params,menuId:'-1'});
}

//查询全部列表（自定义数据过滤，无分页）@0.1
export const findAllList = params => {
    return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject/list`,{params,menuId:'-1'});
}

//事业部审核@1
export const findReviewPage = params => {
    let paramAssign = Object.assign({},{projectStatus:types.PROJECT_STATUS_REVIEW},params);
    return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject`,{params:paramAssign,menuId:'-1'});
}

//事业部部长审核@2
export const findLeaderReviewPage = params => {
    let paramAssign = Object.assign({},{projectStatus:types.PROJECT_STATUS_DEP_REVIEW},params);
    return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject`,{params:paramAssign,menuId:'-1'});
}

//部总监审核@3
export const findDirectorReviewPage = params => {
    let paramAssign = Object.assign({},{projectStatus:types.PROJECT_STATUS_MINISTER_REVIEW},params);
    return axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject`,{params:paramAssign,menuId:'-1'});
}

//详情(包含子列表和审核内容)
export const getReview = (id,params) => axios.get(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject/${id}`,{params,menuId:'-1'});

//添加全部数据（包含子表）
export const addAllFrom = params => axios.post(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject`,params);

//修改全部数据（包含子表）
export const editAllFrom = (id,params) => axios.put(`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject/${id}`,params);

//导出
export const downloadExcel = params => {
	params = Object.assign(params,{menuId:'-1'});
    return axios({
        url:`${SERVER.CMSCLOUD_BIGCUSTOMER}/major/${modelUrl}majorProject/export/excel`,
        method:'get',
        params:params,
        responseType: 'blob'
    });
};
